#!/bin/sh
#================
# find out the new svn repos,and svnadmin create it and svnsync.xuejiang
# 6 5 * * * ads (sh /home/ads/Shell/syninit.sh | tee -a /home/ads/syn.log)
#================
SOURCE_HOST="svn.example.com"
SOURCE_DIR="/opt/svnroot/"
DES_DIR="/opt/svnroot/"
des_host="10.232.*.*"
notallowed="test*|^wl$"
if [ -e ~/initsync.pid ];then
	echo "init svnsync is running...."
	exit
fi
touch ~/initsync.pid

cd ${SOURCE_DIR}; ls >/home/ads/repos.log
cd -
scp /home/ads/repos.log ads@$des_host:~/
scp ${SOURCE_DIR}/conf/authz $des_host/${DES_DIR}/conf/
scp ${SOURCE_DIR}/conf/htpasswd $des_host/${DES_DIR}/conf/
for repos in `ls $DES_DIR`
do
	scp $SOURCE_DIR/$repos/db/uuid $des_host:~/data/${repos}uuid
done
SOURCE_DIR="/opt/svnroot/wl"
DES_DIR="/opt/svnroot/wl"
cd ${SOURCE_DIR}; ls >/home/ads/repos_wl.log
scp /home/ads/repos_wl.log ads@$des_host:~/
scp ${SOURCE_DIR}/conf/* $des_host/${DES_DIR}/conf/
for repos in `ls $DES_DIR`
do
	scp $SOURCE_DIR/$repos/db/uuid $des_host:~/data/_wl/${repos}uuid
done
ssh ads@$des_host "sh /home/ads/sync/syninit_client.sh"
rm -f ~/initsync.pid
